<?php

use App\Core\Traits\Database\SchemaCommentTrait;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCrawlerApps extends Migration
{
    use SchemaCommentTrait;

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('crawler_apps', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('记录ID');
            $table->string('app_name', 128)->comment('应用名称')->unique();
            $table->string('app_id', 120)->comment('应用ID,全英文,允许使用特色字符(-)')->index();
            $table->string('start_url', 128)->comment('应用启动url')->index();
            $table->text('config_json')->comment('json配置信息');
            $table->dateTime('created_at')->nullable(false)->comment('创建时间');
            $table->dateTime('updated_at')->nullable(false)->comment('更新时间');
            $table->dateTime('deleted_at')->nullable(true)->comment('删除时间');
        });
        $this->comment('crawler_apps', '爬虫应用信息记录');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('crawler_apps');
    }
}
